import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/',
            name: 'index',
            component: resolve => require(['@/view/Index'], resolve)
        },
        {
            path: '/login',
            name: 'login',
            component: resolve => require(['@/view/Login'], resolve)
        },
        {
            path: '/index',
            name: 'index',
            component: resolve => require(['@/view/Index'], resolve),
            children: [
                {
                    path: 'system',
                    name: 'system',
                    component: resolve => require(['@/view/System'], resolve),
                    children: [{
                        path: 'user',
                        name: 'user',
                        component: resolve => require(['@/view/system/user/UserManage'], resolve)
                    }, {
                        path: 'config',
                        name: 'config',
                        component: resolve => require(['@/view/system/config/ConfigManage'], resolve)
                    }]
                },
                {
                    path: 'blog',
                    name: 'blog',
                    component: resolve => require(['@/view/Blog'], resolve),
                    children: [{
                        path: 'article',
                        name: 'article',
                        component: resolve => require(['@/view/blog/article/ArticleManage'], resolve)
                    }, {
                        path: 'catalog',
                        name: 'catalog',
                        component: resolve => require(['@/view/blog/catalog/CatalogManage'], resolve)
                    }, {
                        path: 'commentary',
                        name: 'commentary',
                        component: resolve => require(['@/view/blog/commentary/CommentaryManage'], resolve)
                    },{
                        path: 'commentary-list/:aId',
                        name: 'commentary-list',
                        component: resolve => require(['@/view/blog/commentary/ListUnverifyCommentary'], resolve)
                    }
                    ]
                }]
        }, {
            path: '/article-create/:catalogId/:articleId',
            name: 'article-create',
            component: resolve => require(['@/view/blog/article/ArticleCreate'], resolve)
        },
        {
            path: '/message',
            name: 'message',
            component: resolve => require(['@/view/message/Message'], resolve)
        },
        {
            path: '/chat',
            name: 'chat',
            component: resolve => require(['@/view/Chat'], resolve),
            children: [{
                path: 'message-list',
                name: 'message-list',
                component: resolve => require(['@/view/Chat/MessageList'], resolve),
                children: [{
                    path: 'message-detail',
                    name: 'message-detail',
                    component: resolve => require(['@/view/Chat/MessageDetail'], resolve)
                }]
            }, {
                path: 'org-tree',
                name: 'org-tree',
                component: resolve => require(['@/view/Chat/OrgTree'], resolve)
            }]
        },
        {
            path: '*',
            redirect: '/'
        }
    ]
})
